package com.jt.utils;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

@Component
public class ConnectionUtil {
    public  Connection getConnection() throws IOException, TimeoutException {
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost("192.168.136.128");
        factory.setUsername("admin");
        factory.setPort(5672);
        factory.setPassword("admin");
        /*获取连接*/
        Connection connection = factory.newConnection();
        return connection;
    }

}
